#include<stdio.h>

//atoi函数的实现
int my_atoi(const char* str)
{
	int i = 0;
	int sum = 0;
	int num = 0;
	int symb = 1;
	while (str[i] != '\0')
	{
		while (str[i] == ' ' || str[i] == '	')
		{
			i++;
		}
		if (str[i] == '-')
		{
			symb = -1;
			i++;
		}
		if (str[i] == '+')
		{
			i++;
		}
		if (str[i] >= '0' && str[i] <= '9')
		{
			num = (str[i]) - 48;
			i++;
		}
		else
		{
			break;
		}

		sum = 10 * sum + num;

	}
	return symb * sum;
}

int main()
{
	//char* str[] = "		 	 -231hello word";
	int i = my_atoi("		 	 -231hello word");
	printf("%d", i);
	return 0;
}